home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / Evatac Software / Preditor 3.0 / Tools / Extension Module Builder / PreditorExtension.h < prev    next >
Text File  |  1995-12-14  |  35KB  |  979 lines

  1. /************************************************************
  2.  
  3.     PreditorExtension.h
  4.     
  5.     Interface file for Preditor extension modules
  6.  
  7.     © Copyright Evatac Software  1988-1995
  8.     All rights reserved
  9.  
  10. ************************************************************
  11.  
  12.   Here are all of the entry points and their API accessible
  13.   via Preditor Extensions.  To call an entry point from the
  14.   extension, do:
  15.   
  16.       ext<entrypoint>(callbacks, <parameters>)
  17.   
  18.   Your definition of 'main' should look like this:
  19.     
  20.     void main(
  21.         ExternalCallbackBlock    *callbacks,
  22.         WindowRef                window
  23.         );
  24.  
  25.   •••   API Summary   •••
  26.   
  27.     Activate                GetProjectFiles            NewDocument    
  28.     Copy                    GetSelection            NotifyUndo
  29.     Delete                    GetText                    OpenDocument
  30.     DisplayDialog            GetTopLineNum            Paste
  31.     DisplaySelection        IndexEntry                 PeekScanCharacter
  32.     DoneProgress            Insert                    PushClipboard
  33.     DoneScan                IsWordBreak                ReportOSError
  34.     DoProgress                LineCount                ScanContents
  35.     FindText                LineEnd                    SetPreferences
  36.     FindMatch                LineFromPosition        SetSelection
  37.     GetDocumentModDate        LineOffset                SetTopLineNum
  38.     GetDocumentSpec            LineRange                StartProgress
  39.     GetFiles                LineToPosition            TokenReturn
  40.     GetFileText                Lock                    WordSelect
  41.     GetFolder                NextVisiblePosition        
  42.     GetLeading                NextScanCharacter        
  43.     GetPreferences
  44.  
  45.   •••   Begin API Prototypes    •••
  46.   
  47.     long extGetVersion(void);
  48.     
  49.     void GetSelection(
  50.         long            *selAnchor,
  51.         long            *selEnd
  52.         );
  53.      
  54.     void SetSelection(
  55.         long            selAnchor,
  56.         long            selEnd
  57.         );
  58.      
  59.     void DisplaySelection(void);
  60.     
  61.     void Insert(
  62.         Char            *text,
  63.         long            length
  64.         );
  65.      
  66.     void Delete(void);
  67.      
  68.     Handle Copy(void);
  69.      
  70.     void Paste(
  71.         Handle            handle
  72.         );
  73.     
  74.     void PushClipboard(
  75.         Handle            handle
  76.         );
  77.     
  78.     void GetText(
  79.         long            anchor,
  80.         long            end,
  81.         Char            *text,
  82.         long            *maxLength
  83.         );
  84.  
  85.     void Lock(
  86.         Boolean            lockText
  87.         );
  88.         
  89.     long LineCount(void);
  90.   
  91.     long CharacterCount(void);
  92.   
  93.     long LineFromPosition(
  94.         long            position
  95.         );
  96.   
  97.     long LineToPosition(
  98.         long            line
  99.         );
  100.     
  101.     long LineEnd(
  102.         long            line
  103.         );
  104.     
  105.     void LineRange(
  106.         long            lineNumber,
  107.         long            *startLineNumber,
  108.         long            *endLineNumber
  109.         );
  110.         
  111.     long LineOffset(
  112.         long            position
  113.         );
  114.  
  115.     long NextVisiblePosition(
  116.         long        position,
  117.         Boolean        next
  118.         );
  119.     
  120.     long GetTopLineNum(void);
  121.  
  122.     void SetTopLineNum(
  123.          long        lineNumber
  124.          );
  125.  
  126.     long GetLeading(
  127.         long        lineNumber,
  128.         long        *length,
  129.         short        *spacesPerTab,
  130.         short        *hardTab
  131.         );
  132.  
  133.     Boolean IsWordBreak(
  134.         Char        ch
  135.         );
  136.         
  137.     void WordSelect(
  138.         Boolean          next,
  139.         Boolean         select,
  140.         Boolean            extend
  141.         );
  142.  
  143.     void ScanContents(
  144.         long            startPosition
  145.         );
  146.     
  147.     Boolean NextScanCharacter(
  148.         Char                *ch
  149.         );
  150.     
  151.     Boolean PeekScanCharacter(
  152.         Char                *ch
  153.         );
  154.     
  155.     void DoneScan(void);
  156.     
  157.     WindowRef NewDocument(
  158.         long        documentType
  159.         (kEdit, kScript, kBrowser, kIndex, kIndexDouble)
  160.         );
  161.      
  162.     WindowRef OpenDocument(
  163.           FSSpec        *fileSpec
  164.         );
  165.     
  166.     void Activate(
  167.           WindowRef    document
  168.         );
  169.     
  170.     Boolean GetFolder(
  171.         FSSpec        *folderSpec
  172.         );
  173.  
  174.     Boolean GetFiles(
  175.           FSSpec        **specArray,
  176.         long        *count,
  177.         Boolean        sort
  178.         );
  179.     
  180.     Boolean GetProjectFiles(
  181.           FSSpec        **specArray,
  182.         long        *count,
  183.         Boolean        textOnly
  184.         );
  185.         
  186.     Handle GetFileText(
  187.           FSSpec        *fileSpec
  188.         );
  189.     
  190.     Boolean GetDocumentSpec(
  191.         WindowRef    windowRef,
  192.         FSSpec        *fileSpec
  193.         );
  194.     
  195.     long GetDocumentModDate(
  196.         WindowRef    windowRef
  197.         );
  198.     
  199.     long FindText(
  200.         Char        *target,
  201.         long        targetLength,
  202.         long        position,
  203.         Char        *result,
  204.         long        *resultLength
  205.         Boolean        caseSensitive,
  206.         Boolean        pattern
  207.         );
  208.     
  209.     long FindMatch(
  210.         Char        *bracket,
  211.         long        position
  212.         );
  213.     
  214.     Boolean IndexEntry(
  215.         Char            *name,
  216.         Boolean            minor,
  217.         short            operation
  218.         );
  219.         
  220.     void DisplayDialog(
  221.          short            dialogId,
  222.          extHandleProc    handler,
  223.          void            *data,
  224.         short            *itemHit
  225.         );
  226.         
  227.     void StartProgress(
  228.         Char        *text,
  229.         long        total,
  230.         Boolean        canCancel
  231.         );
  232.         
  233.     Boolean DoProgress(
  234.         long        doneThusFar
  235.         );
  236.         
  237.     void DoneProgress(void);
  238.     
  239.     void NotifyUndo(
  240.         Char        *undoActionName
  241.         );
  242.         
  243.     void GetPreferences(
  244.         ResType        type,
  245.         void        *buffer,
  246.         long        *length
  247.         );
  248.     
  249.     void SetPreferences(
  250.         ResType        type,
  251.         void        *buffer,
  252.         long        *length
  253.         );
  254.         
  255.     void ReportOSError(
  256.         short        errorCode
  257.         );
  258.     
  259.     void TokenReturn(
  260.           languageToken    *token
  261.           );
  262.  
  263. ************************************************************/
  264.  
  265. #ifndef __PREDITOREXTENSION__
  266. #define __PREDITOREXTENSION__
  267.  
  268. #include <Dialogs.h>
  269. #include <Files.h>
  270. #include <Windows.h>
  271.  
  272. #ifdef THINKC
  273. typedef WindowPtr        WindowRef;
  274. typedef DialogPtr        DialogRef;
  275. #else
  276. #include <MixedMode.h>
  277. #endif
  278.  
  279. #if defined(powerc) || defined (__powerc)
  280. #pragma options align=mac68k
  281. #endif
  282.  
  283. /*
  284.  * * * * * * * * * CONSTANTS AND MACRO DEFINITIONS * * * * * * * * * *
  285.  */
  286.  
  287. #define kPreditorExtensionVersion            1    /* Current version */
  288.  
  289. enum {
  290.     kEdit            = 'docu',
  291.     kScript            = 'scpt',
  292.     kBrowser        = 'Pbrw',
  293.     kIndex            = 'Pidx',
  294.     kIndexDouble    = 'Pid2'
  295. };
  296.  
  297. /* Values for 'message' parameter to dialog handler callback proc */
  298.  
  299. enum {
  300.     kDlgInit        = 0,
  301.     kDlgUpdate,
  302.     kDlgIdle,
  303.     kDlgClose,
  304.     kDlgClick,
  305.     kDlgItemHit,
  306.     kDlgKey
  307. };
  308.  
  309. /* Values for 'operation' parameter to IndexEntry() */
  310.  
  311. enum {
  312.     kAddEntry,
  313.     kDeleteEntry,
  314.     kSelectEntry
  315. };
  316.  
  317. /*
  318.  * * * * * * * * * TYPE AND STRUCTURE DEFINITIONS * * * * * * * * * *
  319.  */
  320.  
  321. typedef    char            Int8;
  322. typedef    short            Int16;
  323. typedef    long            Int32;
  324. typedef unsigned char    Char;
  325.  
  326. typedef struct ExternalCallbackBlock        ExternalCallbackBlock;
  327.  
  328. typedef short (*extHandlerProc)(
  329.     DialogRef     dialog,
  330.     short         message,
  331.     short         itemHit,
  332.     void         *data
  333.     );
  334.  
  335. #if GENERATINGCFM
  336.  
  337. typedef UniversalProcPtr     extHandlerUPP;
  338.  
  339. enum {
  340.  
  341.     ExtensionUPPInfo    = kCStackBased
  342.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *)))
  343.                              | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowRef))),
  344.  
  345.     GetSelectionUPPInfo    = kCStackBased
  346.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long *))) \
  347.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *))),
  348.  
  349.     SetSelectionUPPInfo    = kCStackBased
  350.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
  351.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  352.  
  353.     DisplaySelectionUPPInfo    = kCStackBased,
  354.     
  355.     InsertUPPInfo         = kCStackBased
  356.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char *)))
  357.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  358.  
  359.     DeleteUPPInfo         = kCStackBased,
  360.     
  361.     CopyUPPInfo         = kCStackBased
  362.                             | RESULT_SIZE(SIZE_CODE(sizeof(Handle))),
  363.                             
  364.     PasteUPPInfo        = kCStackBased
  365.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))),
  366.  
  367.     PushClipboardUPPInfo = kCStackBased
  368.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))),
  369.  
  370.     GetTextUPPInfo         = kCStackBased
  371.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  372.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  373.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Char *)))
  374.                             | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long *))),
  375.  
  376.     LockUPPInfo            = kCStackBased
  377.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Boolean))),
  378.  
  379.     LineCountUPPInfo    = kCStackBased
  380.                               | RESULT_SIZE(SIZE_CODE(sizeof(long))),
  381.                               
  382.     CharacterCountUPPInfo    = kCStackBased
  383.                               | RESULT_SIZE(SIZE_CODE(sizeof(long))),
  384.  
  385.     LineFromPositionUPPInfo    = kCStackBased
  386.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  387.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  388.  
  389.     LineToPositionUPPInfo = kCStackBased
  390.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  391.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  392.  
  393.     LineEndUPPInfo         = kCStackBased
  394.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  395.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  396.  
  397.     LineRangeUPPInfo    = kCStackBased
  398.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  399.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *)))
  400.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))),
  401.     
  402.     LineOffsetUPPInfo    = kCStackBased
  403.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  404.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  405.     
  406.     NextVisiblePositionUPPInfo    = kCStackBased
  407.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  408.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  409.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean))),
  410.  
  411.     GetTopLineNumUPPInfo = kCStackBased
  412.                             | RESULT_SIZE(SIZE_CODE(sizeof(long))),
  413.  
  414.     SetTopLineNumUPPInfo = kCStackBased
  415.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  416.     
  417.     GetLeadingUPPInfo = kCStackBased
  418.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  419.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  420.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *)))
  421.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *)))
  422.                             | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))),
  423.     
  424.     IsWordBreakUPPInfo = kCStackBased
  425.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  426.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char))),
  427.     
  428.     WordSelectUPPInfo = kCStackBased
  429.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Boolean)))
  430.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
  431.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))),
  432.  
  433.     ScanContentsUPPInfo = kCStackBased
  434.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  435.  
  436.     NextScanCharacterUPPInfo = kCStackBased
  437.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  438.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char))),
  439.  
  440.     PeekScanCharacterUPPInfo = kCStackBased
  441.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  442.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char))),
  443.  
  444.     DoneScanUPPInfo = kCStackBased,
  445.  
  446.     NewDocumentUPPInfo    = kCStackBased
  447.                             | RESULT_SIZE(SIZE_CODE(sizeof(WindowRef)))
  448.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  449.  
  450.     OpenDocumentUPPInfo    = kCStackBased
  451.                             | RESULT_SIZE(SIZE_CODE(sizeof(WindowRef)))
  452.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))),
  453.  
  454.     ActivateUPPInfo    = kCStackBased
  455.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowRef))),
  456.                             
  457.     GetFolderUPPInfo    = kCStackBased
  458.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  459.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))),
  460.                             
  461.     GetFilesUPPInfo        = kCStackBased
  462.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  463.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec **)))
  464.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *)))
  465.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))),
  466.  
  467.     GetProjectFilesUPPInfo = kCStackBased
  468.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  469.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec **)))
  470.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *)))
  471.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))),
  472.  
  473.     GetFileTextUPPInfo    = kCStackBased
  474.                             | RESULT_SIZE(SIZE_CODE(sizeof(Handle)))
  475.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))),
  476.  
  477.     GetDocumentSpecUPPInfo = kCStackBased
  478.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  479.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowRef)))
  480.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FSSpec *))),
  481.                             
  482.     GetDocumentModDateUPPInfo = kCStackBased
  483.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  484.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowRef))),
  485.  
  486.     FindTextUPPInfo = kCStackBased
  487.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  488.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char *)))
  489.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  490.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  491.                             | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Char *)))
  492.                             | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long *)))
  493.                             | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(Boolean)))
  494.                             | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(Boolean))),
  495.  
  496.     FindMatchUPPInfo = kCStackBased
  497.                             | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  498.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char *)))
  499.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  500.  
  501.     IndexEntryUPPInfo    = kCStackBased
  502.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  503.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  504.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(extHandlerUPP)))
  505.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))), 
  506.  
  507.     DisplayDialogUPPInfo    = kCStackBased
  508.                             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  509.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char *)))
  510.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
  511.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short))), 
  512.                             
  513.     DialogHandlerUPPInfo    = kCStackBased
  514.                             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  515.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogRef)))
  516.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  517.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  518.                             | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void *))),
  519.  
  520.     StartProgressUPPInfo    = kCStackBased
  521.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char *)))
  522.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  523.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))),
  524.  
  525.     DoProgressUPPInfo    = kCStackBased
  526.                             | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  527.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))),
  528.  
  529.     DoneProgressUPPInfo    = kCStackBased,
  530.  
  531.     NotifyUndoUPPInfo    = kCStackBased
  532.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Char *))),
  533.     
  534.     GetPreferencesUPPInfo    = kCStackBased
  535.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  536.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
  537.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))),
  538.  
  539.     SetPreferencesUPPInfo    = kCStackBased
  540.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType)))
  541.                             | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
  542.                             | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))),
  543.         
  544.     ReportOSErrorUPPInfo = kCStackBased
  545.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))),
  546.  
  547.     TokenReturnUPPInfo = kCStackBased
  548.                             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long *)))
  549. };
  550.  
  551. typedef UniversalProcPtr GetSelectionUPP;
  552. typedef UniversalProcPtr SetSelectionUPP;
  553. typedef UniversalProcPtr DisplaySelectionUPP;
  554. typedef UniversalProcPtr InsertUPP;
  555. typedef UniversalProcPtr DeleteUPP;
  556. typedef UniversalProcPtr CopyUPP;
  557. typedef UniversalProcPtr PasteUPP;
  558. typedef UniversalProcPtr PushClipboardUPP;
  559. typedef UniversalProcPtr GetTextUPP;
  560. typedef UniversalProcPtr LockUPP;
  561. typedef UniversalProcPtr LineCountUPP;
  562. typedef UniversalProcPtr CharacterCountUPP;
  563. typedef UniversalProcPtr LineFromPositionUPP;
  564. typedef UniversalProcPtr LineToPositionUPP;
  565. typedef UniversalProcPtr LineEndUPP;
  566. typedef UniversalProcPtr LineRangeUPP;
  567. typedef UniversalProcPtr LineOffsetUPP;
  568. typedef UniversalProcPtr NextVisiblePositionUPP;
  569. typedef UniversalProcPtr GetTopLineNumUPP;
  570. typedef UniversalProcPtr SetTopLineNumUPP;
  571. typedef UniversalProcPtr GetLeadingUPP;
  572. typedef UniversalProcPtr IsWordBreakUPP;
  573. typedef UniversalProcPtr WordSelectUPP;
  574. typedef UniversalProcPtr ScanContentsUPP;
  575. typedef UniversalProcPtr NextScanCharacterUPP;
  576. typedef UniversalProcPtr PeekScanCharacterUPP;
  577. typedef UniversalProcPtr DoneScanUPP;
  578. typedef UniversalProcPtr NewDocumentUPP;
  579. typedef UniversalProcPtr OpenDocumentUPP;
  580. typedef UniversalProcPtr ActivateUPP;
  581. typedef UniversalProcPtr GetFolderUPP;
  582. typedef UniversalProcPtr GetFilesUPP;
  583. typedef UniversalProcPtr GetProjectFilesUPP;
  584. typedef UniversalProcPtr GetFileTextUPP;
  585. typedef UniversalProcPtr GetDocumentSpecUPP;
  586. typedef UniversalProcPtr GetDocumentModDateUPP;
  587. typedef UniversalProcPtr ReportOSErrorUPP;
  588. typedef UniversalProcPtr GetPreferencesUPP;
  589. typedef UniversalProcPtr SetPreferencesUPP;
  590. typedef UniversalProcPtr FindTextUPP;
  591. typedef UniversalProcPtr FindMatchUPP;
  592. typedef UniversalProcPtr IndexEntryUPP;
  593. typedef UniversalProcPtr DisplayDialogUPP;
  594. typedef UniversalProcPtr StartProgressUPP;
  595. typedef UniversalProcPtr DoProgressUPP;
  596. typedef UniversalProcPtr DoneProgressUPP;
  597. typedef UniversalProcPtr NotifyUndoUPP;
  598. typedef UniversalProcPtr TokenReturnUPP;
  599.  
  600. #define extGetSelection(callbacks, selAnchor, selEnd)                \
  601.         CallUniversalProc((UniversalProcPtr)((callbacks)->GetSelection), GetSelectionUPPInfo, (selAnchor), (selEnd))
  602. #define extSetSelection(callbacks, selAnchor, selEnd)                \
  603.         CallUniversalProc((UniversalProcPtr)((callbacks)->SetSelection), SetSelectionUPPInfo, (selAnchor), (selEnd))
  604. #define extDisplaySelection(callbacks)                                \
  605.         CallUniversalProc((UniversalProcPtr)((callbacks)->DisplaySelection), DisplaySelectionUPPInfo)
  606. #define extInsert(callbacks, text, length)                            \
  607.         CallUniversalProc((UniversalProcPtr)((callbacks)->Insert), InsertUPPInfo, (text), (length))
  608. #define extDelete(callbacks)                                        \
  609.         CallUniversalProc((UniversalProcPtr)((callbacks)->Delete), DeleteUPPInfo)
  610. #define extCopy(callbacks)                                            \
  611.         (Handle) CallUniversalProc((UniversalProcPtr)((callbacks)->Copy), CopyUPPInfo)
  612. #define extPaste(callbacks, hdl)                                    \
  613.         CallUniversalProc((UniversalProcPtr)((callbacks)->Paste), PasteUPPInfo, (hdl))
  614. #define extPushClipboard(callbacks, hdl)                            \
  615.         CallUniversalProc((UniversalProcPtr)((callbacks)->PushClipboard), PushClipboardUPPInfo, (hdl))
  616. #define extGetText(callbacks, anchor, end, text, length)                                        \
  617.         CallUniversalProc((UniversalProcPtr)((callbacks)->GetText), GetTextUPPInfo, (anchor), (end), (text), (length))
  618. #define extLock(callbacks, hdl)                                        \
  619.         CallUniversalProc((UniversalProcPtr)((callbacks)->Lock), LockUPPInfo, (hdl))
  620. #define extLineCount(callbacks)                                        \
  621.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->LineCount), LineCountUPPInfo)
  622. #define extCharacterCount(callbacks)                                        \
  623.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->CharacterCount), CharacterCountUPPInfo)
  624. #define extLineFromPosition(callbacks, position)                    \
  625.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->LineFromPosition), LineFromPositionUPPInfo, (position))
  626. #define extLineToPosition(callbacks, line)                            \
  627.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->LineToPosition), LineToPositionUPPInfo, (line))
  628. #define extLineEnd(callbacks, line)                                    \
  629.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->LineEnd), LineEndUPPInfo, (line))
  630. #define extLineRange(callbacks, line, start, end)                    \
  631.         CallUniversalProc((UniversalProcPtr)((callbacks)->LineRange), LineRangeUPPInfo, (line), (start), (end))
  632. #define extLineOffset(callbacks, pos)                                \
  633.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->LineOffset), LineOffsetUPPInfo, (pos))
  634. #define extNextVisiblePosition(callbacks, pos, next)                \
  635.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->NextVisiblePosition), NextVisiblePositionUPPInfo, (pos), (next))
  636. #define extGetTopLineNum(callbacks)                                    \
  637.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->GetTopLineNum), GetTopLineNumUPPInfo)
  638. #define extSetTopLineNum(callbacks, line)                            \
  639.         CallUniversalProc((UniversalProcPtr)((callbacks)->SetTopLineNum), SetTopLineNumUPPInfo, (line))
  640. #define extGetLeading(callbacks, line, length, tab, hardTab)        \
  641.         CallUniversalProc((UniversalProcPtr)((callbacks)->GetLeading), GetLeadingUPPInfo, (line), (length), (tab), (hardTab))
  642. #define extIsWordBreak(callbacks, ch)                                \
  643.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->IsWordBreak), IsWordBreakUPPInfo, (ch))
  644. #define extWordSelect(callbacks, next, select, extend)                \
  645.         CallUniversalProc((UniversalProcPtr)((callbacks)->WordSelect), WordSelectUPPInfo, (next), (select), (extend))
  646. #define extScanContents(callbacks, pos)                                \
  647.         CallUniversalProc((UniversalProcPtr)((callbacks)->ScanContents), ScanContentsUPPInfo, (pos))
  648. #define extNextScanCharacter(callbacks, ch)                            \
  649.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->NextScanCharacter), NextScanCharacterUPPInfo, (ch))
  650. #define extPeekScanCharacter(callbacks, ch)                            \
  651.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->PeekScanCharacter), PeekScanCharacterUPPInfo, (ch))
  652. #define extDoneScan(callbacks)                                        \
  653.         CallUniversalProc((UniversalProcPtr)((callbacks)->DoneScan), DoneScanUPPInfo)
  654. #define extNewDocument(callbacks, type)                                \
  655.         (WindowRef) CallUniversalProc((UniversalProcPtr)((callbacks)->NewDocument), NewDocumentUPPInfo, (type))
  656. #define extOpenDocument(callbacks, fileSpec)                        \
  657.         (WindowRef) CallUniversalProc((UniversalProcPtr)((callbacks)->OpenDocument), OpenDocumentUPPInfo, (fileSpec))
  658. #define extActivate(callbacks, doc)                                    \
  659.         (WindowRef) CallUniversalProc((UniversalProcPtr)((callbacks)->Activate), ActivateUPPInfo, (doc))
  660. #define extGetFolder(callbacks, fileSpec)                            \
  661.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->GetFolder), GetFolderUPPInfo, (fileSpec))
  662. #define extGetFiles(callbacks, specArray, count, sort)                \
  663.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->GetFiles), GetFilesUPPInfo, (specArray), (count), (sort))
  664. #define extGetProjectFiles(callbacks, specArray, count, textOnly)    \
  665.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->GetProjectFiles), GetProjectFilesUPPInfo, (specArray), (count), (textOnly))
  666. #define extGetFileText(callbacks, fileSpec)                            \
  667.         (Handle) CallUniversalProc((UniversalProcPtr)((callbacks)->GetFileText), GetFileTextUPPInfo, (fileSpec))
  668. #define extGetDocumentSpec(callbacks, window, fileSpec)                \
  669.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->GetDocumentSpec), GetDocumentSpecUPPInfo, (window), (fileSpec))
  670. #define extGetDocumentModDate(callbacks, window)                    \
  671.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->GetDocumentModDate), GetDocumentModDateUPPInfo, (window))
  672. #define extReportOSError(callbacks, code)                            \
  673.         CallUniversalProc((UniversalProcPtr)((callbacks)->ReportOSError), ReportOSErrorUPPInfo, (code))
  674. #define extFindText(callbacks, target, tlen, pos, result, resultLen, sens, pat)    \
  675.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->FindText), FindTextUPPInfo, (target), (tlen), (pos), (result), (resultLen), (sens), (pat))
  676. #define extFindMatch(callbacks, bracket, pos)                        \
  677.         (long) CallUniversalProc((UniversalProcPtr)((callbacks)->FindMatch), FindMatchUPPInfo, (bracket), (pos))
  678. #define extStartProgress(callbacks, text, total, canCancel)            \
  679.         CallUniversalProc((UniversalProcPtr)((callbacks)->StartProgress), StartProgressUPPInfo, (text), (total), (canCancel))
  680. #define extDoProgress(callbacks, thusFar)                            \
  681.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->DoProgress), DoProgressUPPInfo, (thusFar))
  682. #define extDoneProgress(callbacks)                                    \
  683.         CallUniversalProc((UniversalProcPtr)((callbacks)->DoneProgress), DoneProgressUPPInfo)
  684. #define extNotifyUndo(callbacks, name)                                \
  685.         CallUniversalProc((UniversalProcPtr)((callbacks)->NotifyUndo), NotifyUndoUPPInfo, (name))
  686. #define extGetPreferences(callbacks, type, buffer, length)            \
  687.         CallUniversalProc((UniversalProcPtr)((callbacks)->GetPreferences), GetPreferencesUPPInfo, (type), (buffer), (length))
  688. #define extSetPreferences(callbacks, type, buffer, length)            \
  689.         CallUniversalProc((UniversalProcPtr)((callbacks)->SetPreferences), SetPreferencesUPPInfo, (type), (buffer), (length))
  690. #define extIndexEntry(callbacks, name, minor, op)                    \
  691.         (Boolean) CallUniversalProc((UniversalProcPtr)((callbacks)->IndexEntry), IndexEntryUPPInfo, (name), (minor), (op))
  692. #define extDisplayDialog(callbacks, id, handler, data, itemHit)     {    \
  693.             extHandlerUPP    upp = (extHandlerUPP) NewRoutineDescriptor((ProcPtr) (handler), DialogHandlerUPPInfo, GetCurrentArchitecture()); \
  694.             *itemHit = (short) CallUniversalProc((UniversalProcPtr)((callbacks)->DisplayDialog), DisplayDialogUPPInfo, (id), (upp), (data)); \
  695.             DisposeRoutineDescriptor(upp); \
  696.         }
  697. #define extTokenReturn(callbacks, token)                            \
  698.         CallUniversalProc((UniversalProcPtr)((callbacks)->TokenReturn), TokenReturnUPPInfo, (token))
  699. #else
  700.  
  701. typedef extHandlerProc     extHandlerUPP;
  702.  
  703. typedef    void        (*GetSelectionProc)     (long *selAnchor, long *selEnd);
  704. typedef    void        (*SetSelectionProc)     (long selAnchor, long selEnd);
  705. typedef    void        (*DisplaySelectionProc) (void);
  706. typedef void        (*InsertProc)            (Char *text, long length);
  707. typedef void        (*DeleteProc)            (void);
  708. typedef Handle        (*CopyProc)                (void);
  709. typedef void        (*PasteProc)            (Handle hdl);
  710. typedef void        (*PushClipboardProc)    (Handle hdl);
  711. typedef void        (*GetTextProc)            (long anchor, long end, Char *text, long *maxLength);
  712. typedef void        (*LockProc)                (Boolean lockText);
  713. typedef long        (*LineCountProc)        (void);
  714. typedef long        (*CharacterCountProc)    (void);
  715. typedef long        (*LineFromPositionProc)    (long position);
  716. typedef long        (*LineToPositionProc)    (long line);
  717. typedef long        (*LineEndProc)            (long line);
  718. typedef void         (*LineRangeProc)        (long lineNumber, long *startLineNumber, long *endLineNumber);
  719. typedef long        (*LineOffsetProc)        (long position);
  720. typedef long        (*NextVisiblePositionProc)(long position, Boolean next);
  721. typedef long        (*GetTopLineNumProc)    (void);
  722. typedef void        (*SetTopLineNumProc)    (long topLineNum);
  723. typedef long        (*GetLeadingProc)        (long line, long *length, short *spacePerTab, short *hardTab);
  724. typedef Boolean        (*IsWordBreakProc)        (Char ch);
  725. typedef void        (*WordSelectProc)        (Boolean next, Boolean select, Boolean extend);
  726. typedef void        (*ScanContentsProc)        (long startPosition);
  727. typedef Boolean        (*NextScanCharacterProc)(Char *ch);
  728. typedef Boolean        (*PeekScanCharacterProc)(Char *ch);
  729. typedef void        (*DoneScanProc)            (void);
  730.  
  731. typedef    WindowRef    (*NewDocumentProc)        (long type);
  732. typedef    WindowRef    (*OpenDocumentProc)        (FSSpec *fileSpec);
  733. typedef    void        (*ActivateProc)            (WindowRef document);
  734. typedef    Boolean        (*GetFolderProc)        (FSSpec *folderSpec);
  735. typedef    Boolean        (*GetFilesProc)            (FSSpec **specArray, long *count, Boolean sort);
  736. typedef    Boolean        (*GetProjectFilesProc)    (FSSpec **specArray, long *count, Boolean textOnly);
  737. typedef    Handle        (*GetFileTextProc)        (FSSpec *fileSpec);
  738. typedef    Boolean        (*GetDocumentSpecProc)    (WindowRef window, FSSpec *fileSpec);
  739. typedef    long        (*GetDocumentModDateProc) (WindowRef window);
  740. typedef    void        (*ReportOSErrorProc)    (short errorCode);
  741. typedef    long        (*FindTextProc)            (Char *target, long targetLen, long position, Char *result, long *resultLen, Boolean sens, Boolean pat);
  742. typedef    long        (*FindMatchProc)        (Char *bracket, long position);
  743. typedef    Boolean        (*IndexEntryProc)        (Char *name, Boolean minor, short op);
  744. typedef    short        (*DisplayDialogProc)    (short id, extHandlerUPP handler, void *data);
  745. typedef    void        (*StartProgressProc)    (Char *text, long total, Boolean canCancel);
  746. typedef    Boolean        (*DoProgressProc)        (long totalThusFar);
  747. typedef    void        (*DoneProgressProc)        (void);
  748. typedef    void        (*NotifyUndoProc)        (Char *undoActioName);
  749. typedef    void        (*GetPreferencesProc)    (ResType type, void *buffer, long *length);
  750. typedef    void        (*SetPreferencesProc)    (ResType type, void *buffer, long *length);
  751. typedef    void        (*TokenReturnProc)    (void *token);
  752.  
  753. typedef GetSelectionProc        GetSelectionUPP;
  754. typedef SetSelectionProc        SetSelectionUPP;
  755. typedef DisplaySelectionProc    DisplaySelectionUPP;
  756. typedef InsertProc                 InsertUPP;
  757. typedef DeleteProc                 DeleteUPP;
  758. typedef CopyProc                 CopyUPP;
  759. typedef PasteProc                 PasteUPP;
  760. typedef PushClipboardProc         PushClipboardUPP;
  761. typedef GetTextProc             GetTextUPP;
  762. typedef LockProc                 LockUPP;
  763. typedef LineCountProc             LineCountUPP;
  764. typedef CharacterCountProc         CharacterCountUPP;
  765. typedef LineFromPositionProc    LineFromPositionUPP;
  766. typedef LineToPositionProc         LineToPositionUPP;
  767. typedef LineEndProc             LineEndUPP;
  768. typedef LineRangeProc            LineRangeUPP;
  769. typedef LineOffsetProc            LineOffsetUPP;
  770. typedef NextVisiblePositionProc NextVisiblePositionUPP;
  771. typedef GetTopLineNumProc        GetTopLineNumUPP;
  772. typedef SetTopLineNumProc        SetTopLineNumUPP;
  773. typedef GetLeadingProc            GetLeadingUPP;
  774. typedef IsWordBreakProc            IsWordBreakUPP;
  775. typedef WordSelectProc            WordSelectUPP;
  776. typedef ScanContentsProc        ScanContentsUPP;
  777. typedef NextScanCharacterProc    NextScanCharacterUPP;
  778. typedef PeekScanCharacterProc    PeekScanCharacterUPP;
  779. typedef DoneScanProc            DoneScanUPP;
  780.  
  781. typedef NewDocumentProc           NewDocumentUPP;
  782. typedef OpenDocumentProc           OpenDocumentUPP;
  783. typedef ActivateProc               ActivateUPP;
  784. typedef GetFolderProc           GetFolderUPP;
  785. typedef GetFilesProc               GetFilesUPP;
  786. typedef GetProjectFilesProc        GetProjectFilesUPP;
  787. typedef GetFileTextProc           GetFileTextUPP;
  788. typedef GetDocumentSpecProc       GetDocumentSpecUPP;
  789. typedef GetDocumentModDateProc  GetDocumentModDateUPP;
  790. typedef FindTextProc             FindTextUPP;
  791. typedef FindMatchProc             FindMatchUPP;
  792. typedef IndexEntryProc             IndexEntryUPP;
  793. typedef DisplayDialogProc         DisplayDialogUPP;
  794. typedef StartProgressProc         StartProgressUPP;
  795. typedef DoProgressProc             DoProgressUPP;
  796. typedef DoneProgressProc         DoneProgressUPP;
  797. typedef NotifyUndoProc             NotifyUndoUPP;
  798. typedef GetPreferencesProc         GetPreferencesUPP;
  799. typedef SetPreferencesProc         SetPreferencesUPP;
  800. typedef ReportOSErrorProc         ReportOSErrorUPP;
  801. typedef TokenReturnProc         TokenReturnUPP;
  802.  
  803. #define extGetSelection(callbacks, selAnchor, selEnd)        \
  804.         (*((callbacks)->GetSelection))((selAnchor), (selEnd))
  805. #define extSetSelection(callbacks, selAnchor, selEnd)        \
  806.         (*(callbacks->SetSelection))((selAnchor), (selEnd))
  807. #define extDisplaySelection(callbacks)                        \
  808.         (*(callbacks->DisplaySelection))()
  809. #define extInsert(callbacks, text, length)                    \
  810.         (*(callbacks->Insert))((text), (length))
  811. #define extDelete(callbacks)                                \
  812.         (*(callbacks->Delete))()
  813. #define extCopy(callbacks)                                     \
  814.         (*(callbacks->Copy))()
  815. #define extPaste(callbacks, hdl)                            \
  816.         (*(callbacks->Paste))((hdl))
  817. #define extPushClipboard(callbacks, hdl)                    \
  818.         (*(callbacks->PushClipboard))((hdl))
  819. #define extGetText(callbacks, anchor, end, text, length)    \
  820.         (*(callbacks->GetText))((anchor), (end), (text), (length))
  821. #define extLock(callbacks, lock)                            \
  822.         (*(callbacks->Lock))((lock))
  823. #define extLineCount(callbacks)                                \
  824.         (*(callbacks->LineCount))()
  825. #define extCharacterCount(callbacks)                        \
  826.         (*(callbacks->CharacterCount))()
  827. #define extLineFromPosition(callbacks, position)            \
  828.         (*(callbacks->LineFromPosition))((position))
  829. #define extLineToPosition(callbacks, line)                    \
  830.         (*(callbacks->LineToPosition))((line))
  831. #define extLineEnd(callbacks, line)                            \
  832.         (*(callbacks->LineEnd))((line))
  833. #define extLineRange(callbacks, line, start, end)            \
  834.         (*(callbacks->LineRange))((line), (start), (end))
  835. #define extLineOffset(callbacks, pos)                        \
  836.         (*(callbacks->LineOffset))((pos))
  837. #define extNextVisiblePosition(callbacks, pos, next)        \
  838.         (*(callbacks->NextVisiblePosition))((pos), (next))
  839. #define extGetTopLineNum(callbacks)                            \
  840.         (*(callbacks->GetTopLineNum))()
  841. #define extSetTopLineNum(callbacks, line)                    \
  842.         (*(callbacks->SetTopLineNum))((line))
  843. #define extGetLeading(callbacks, line, length, tab, hardTab)\
  844.         (*(callbacks->GetLeading))((line), (length), (tab), (hardTab))
  845. #define extIsWordBreak(callbacks, ch)                        \
  846.         (*(callbacks->IsWordBreak))((ch))
  847. #define extWordSelect(callbacks, next, select, extend)        \
  848.         (*(callbacks->WordSelect))((next), (select), (extend))
  849. #define extScanContents(callbacks, pos)                        \
  850.         (*(callbacks->ScanContents))((pos))
  851. #define extNextScanCharacter(callbacks, ch)                    \
  852.         (*(callbacks->NextScanCharacter))((ch))
  853. #define extPeekScanCharacter(callbacks, ch)                    \
  854.         (*(callbacks->PeekScanCharacter))((ch))
  855. #define extDoneScan(callbacks)                                \
  856.         (*(callbacks->DoneScan))()
  857. #define extNewDocument(callbacks, type)                        \
  858.         (*(callbacks->NewDocument))(type)
  859. #define extOpenDocument(callbacks, filesSpec)                \
  860.         (*(callbacks->OpenDocument))(filesSpec)
  861. #define extActivate(callbacks, doc)                            \
  862.         (*(callbacks->Activate))(doc)
  863. #define extGetFolder(callbacks, folderSpec)                    \
  864.         (*(callbacks->GetFolder))(folderSpec)
  865. #define extGetFiles(callbacks, specArray, count, sort)        \
  866.         (*(callbacks->GetFiles))(specArray, count, sort)
  867. #define extGetProjectFiles(callbacks, specArray, count, txt)\
  868.         (*(callbacks->GetProjectFiles))(specArray, count, txt)
  869. #define extGetFileText(callbacks, fileSpec)                    \
  870.         (*(callbacks->GetFileText))(fileSpec)
  871. #define extGetDocumentSpec(callbacks, window, fileSpec)        \
  872.         (*(callbacks->GetDocumentSpec))(window, fileSpec)
  873. #define extGetDocumentModDate(callbacks, window)            \
  874.         (*(callbacks->GetDocumentModDate))(window)
  875. #define extReportOSError(callbacks, code)                    \
  876.         (*(callbacks->ReportOSError))(code)
  877. #define extFindText(callbacks, target, tlen, pos, result, resultLen, sens, pat)        \
  878.         (*(callbacks->FindText))(target, tlen, pos, result, resultLen, sens, pat)
  879. #define extFindMatch(callbacks, bracket, pos)                \
  880.         (*(callbacks->FindMatch))(bracket, pos)
  881. #define extIndexEntry(callbacks, name, minor, op)            \
  882.          (*(callbacks->IndexEntry))(name, minor, op)
  883. #define extDisplayDialog(callbacks, id, handler, data, itemHit)    \
  884.          *itemHit = (*(callbacks->DisplayDialog))(id, handler, data)
  885. #define extStartProgress(callbacks, text, total, can)        \
  886.         (*(callbacks->StartProgress))(text, total, can)
  887. #define extDoProgress(callbacks, thus)                        \
  888.         (*(callbacks->DoProgress))(thus)
  889. #define extDoneProgress(callbacks)                            \
  890.         (*(callbacks->DoneProgress))()    
  891. #define extNotifyUndo(callbacks, name)                        \
  892.         (*(callbacks->NotifyUndo))(name)    
  893. #define extGetPreferences(callbacks, type, buffer, len)        \
  894.         (*(callbacks->GetPreferences))(type, buffer, len)
  895. #define extSetPreferences(callbacks, type, buffer, len)        \
  896.         (*(callbacks->SetPreferences))(type, buffer, len)
  897. #define extTokenReturn(callbacks, token)                    \
  898.         (*(callbacks->TokenReturn))(token)
  899.  
  900. #endif
  901.  
  902. #define extGetVersion(callbacks)        ((callbacks)->version)
  903.  
  904. /*
  905.  * *     ExternalCallbackBlock      * * *
  906.  *
  907.  * This structure is private.  Do not access any members 
  908.  * directly.
  909.  */
  910.  
  911. struct ExternalCallbackBlock {
  912.  
  913.     long                    version;
  914.     void                    *target;
  915.     void                    *reader;
  916.     
  917.     GetSelectionUPP            GetSelection;
  918.     SetSelectionUPP            SetSelection;
  919.     DisplaySelectionUPP        DisplaySelection;
  920.     
  921.     InsertUPP                Insert;
  922.     DeleteUPP                Delete;
  923.     CopyUPP                    Copy;
  924.     PasteUPP                Paste;
  925.     PushClipboardUPP        PushClipboard;
  926.     GetTextUPP                GetText;
  927.     LockUPP                    Lock;
  928.     
  929.     LineCountUPP            LineCount;
  930.     CharacterCountUPP        CharacterCount;
  931.     LineFromPositionUPP        LineFromPosition;
  932.     LineToPositionUPP        LineToPosition;
  933.     LineEndUPP                LineEnd;
  934.     LineRangeUPP            LineRange;
  935.     LineOffsetUPP            LineOffset;
  936.     NextVisiblePositionUPP    NextVisiblePosition;
  937.     
  938.     GetTopLineNumUPP        GetTopLineNum;
  939.     SetTopLineNumUPP        SetTopLineNum;
  940.     GetLeadingUPP            GetLeading;
  941.     IsWordBreakUPP            IsWordBreak;
  942.     WordSelectUPP            WordSelect;
  943.     NotifyUndoUPP            NotifyUndo;
  944.     
  945.     ScanContentsUPP            ScanContents;
  946.     NextScanCharacterUPP    NextScanCharacter;
  947.     PeekScanCharacterUPP    PeekScanCharacter;
  948.     DoneScanUPP                DoneScan;
  949.  
  950.     NewDocumentUPP            NewDocument;
  951.     OpenDocumentUPP            OpenDocument;
  952.     ActivateUPP                Activate;
  953.     GetFolderUPP            GetFolder;
  954.     GetFilesUPP                GetFiles;
  955.     GetProjectFilesUPP        GetProjectFiles;
  956.     GetFileTextUPP            GetFileText;
  957.     GetDocumentSpecUPP        GetDocumentSpec;
  958.     GetDocumentModDateUPP    GetDocumentModDate;
  959.     FindTextUPP                FindText;
  960.     FindMatchUPP            FindMatch;
  961.     
  962.     IndexEntryUPP            IndexEntry;
  963.  
  964.     DisplayDialogUPP        DisplayDialog;
  965.  
  966.     StartProgressUPP        StartProgress;
  967.     DoProgressUPP            DoProgress;
  968.     DoneProgressUPP            DoneProgress;
  969.     
  970.     GetPreferencesUPP        GetPreferences;
  971.     SetPreferencesUPP        SetPreferences;
  972.     
  973.     ReportOSErrorUPP        ReportOSError;
  974.  
  975.     TokenReturnUPP            TokenReturn;
  976. };
  977.  
  978. #endif
  979.